home *** CD-ROM | disk | FTP | other *** search
- Path: news.iadfw.net!usenet
- From: Mark Nelson <markn@airmail.net>
- Newsgroups: comp.lang.c
- Subject: Re: RS232 & Strings
- Date: Wed, 27 Mar 1996 22:54:03 -0600
- Organization: customer of Internet America
- Message-ID: <315A1B6B.2808@airmail.net>
- References: <Pine.SUN.3.91.960326144705.10920A-100000@Ra.MsState.Edu> <315953AB.47C1@airmail.net> <4jc8okINNahh@mayne.ugrad.cs.ubc.ca>
- NNTP-Posting-Host: dal07-16.ppp.iadfw.net
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 2.0GoldB2 (Win95; I)
-
- Kazimir Kylheku wrote:
- >
- > In article <315953AB.47C1@airmail.net>, Mark Nelson <markn@airmail.net> wrote:
- > >> I need to be able to receive a string that is ten
- > >
- > >You are going to need an interrupt driven routine to receive characters.
- > >Trying to read them in using polling is not going to work, because
- > >you are inevitably going to miss some characters.
- >
- > That is false. Polling is the fastest way to receive characters, at the expense
- > of everything. You are less likely to miss characters with _continous_ polling
-
- Polling is fine on a machine where you have control over real-time aspects of
- your O/S. Under Windows or MS-DOS, this is not possible. You cannot disable
- all other interrupts and expect your machine to work properly. So while it
- would be nice to disable interrupts and poll for input, it simply isn't
- practical. Under Windows, it becomes close to impossible.
-
- > than with interrupts. The reason modern serial adapters have buffered FIFO
- > UARTS is precisely for the reason that interrupt service routines just kick in
- > too slowly to keep up with the bps rate! A CPU-wasting polled loop on the same
- > hardware could happily ignore the UART, and just pull bytes directly off the
- > receive register. I've had one programmer tell me that he transferred a file
- > between two 8088 machines at full 115,200 kbps using polled I/O, a feat you
- > could not accomplish with an interrupt service routine on the same hardware.
-
- Once again, this is great if you are writing your data directly to a memory buffer,
- and you aren't worried about messing up the system time, but once you start
- writing to disk, all bets are off.
-
- For most programmers working on desktop machines, suggesting that they use polling
- for their RS-232 applications is *very* bad advice.
-
- Mark Nelson
- http://web2.airmail.net/markn
-